package cn.wf.apigateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;

@SpringBootApplication
@EnableZuulProxy  //添加路由转发功能
public class ApiGatewayApplication {

    public static void main(String[] args) {
        SpringApplication.run(ApiGatewayApplication.class, args);
    }

    /**
     * 动态路由，完成配置的动态注入，自定义的路由配置在git上，和代码动态注入
     */
    @ConfigurationProperties("zuul")
    @RefreshScope
    public ZuulProperties ZuulProperties() {
        return new ZuulProperties();
    }
}
